import java.util.*;

public class day1 {
    /**
     * AB5 点击消除
     * https://www.nowcoder.com/practice/8d3643ec29654cf8908b5cf3a0479fd5?tpId=308&tqId=40462&ru=/exam/oj
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] s = in.next().toCharArray();

        Stack<Character> stack = new Stack<>();
        for(int i = 0;i < s.length;i++) {
            char ch = s[i];
            if(stack.size() != 0 && ch == stack.get(stack.size() - 1)) {
                stack.remove(stack.size() - 1);
            }else {
                stack.add(ch);
            }
        }
        StringBuffer ret = new StringBuffer();
        for(int i = 0;i < stack.size();i++) {
            ret.append(stack.get(i));
        }

        System.out.print(ret.length() != 0 ? ret.toString() : 0);
    }

    /**
     * NC313 两个数组的交集
     * https://www.nowcoder.com/practice/56ea71d1f4e94de2aaec10e985874cce?tpId=196&tqId=40269&ru=/exam/oj
     */
    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        // write code here
        Set<Integer> hash = new HashSet<>();
        ArrayList<Integer> ret = new ArrayList<>();
        for(int x : nums1) {
            hash.add(x);
        }

        for(int num : nums2) {
            if (hash.contains(num)) {
                ret.add(num);
                hash.remove(num);
            }
        }
        return ret;
    }

    /**
     * BC153 [NOIP2010]数字统计
     * https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a?tpId=290&tqId=39941&ru=/exam/oj
     */
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt();
        int r = in.nextInt();
        int count = 0;
        for(int i = l;i <= r;i++) {
            int x = i;
            while(x != 0) {
                if(x % 10 == 2) {
                    count++;
                }
                x /= 10;
            }
        }
        System.out.print(count);
    }
}
